{extend name="index/index" /}

{block name="navigation"}
<nav class="main-nav">
        <div class="menu-top-menu-container">
                <ul id="menu-top-menu" class="clearfix">
                        <li><a href="{:url('index/index/index')}">首页</a></li>
                        <li><a href="{:url('index/Recall/index')}">韶华追忆</a></li>
                        <li><a href="{:url('index/Mood/index')}">心情随笔</a></li>
                        <li><a href="{:url('index/Share/index')}">技术分享</a></li>
                        <li class="current-menu-item"><a href="{:url('index/Post/index')}">技术讨论</a></li>
                        <!--<li><a href="{:url('index/Archive/index')}">个人归档</a></li>-->
                        <li><a href="{:url('/index/Me/index')}">关于我</a></li>
                </ul>
        </div>
</nav>
{/block}

{block name="indexmain"}
{css href="/static/index/assets/libs/bootstrap/css/bootstrap.min.css"}
{js href="/static/index/assets/libs/bootstrap/js/bootstrap.min.js"}
{js href="/static/index/js/jquery.min.js"}
{css href="/static/index/css/toastr.min.css" }
{js href="/static/index/js/toastr.min.js"}

                <!-- Start of Page Container -->
                <div class="page-container">
                        <div class="container">
                                <div class="row">

                                        <!-- start of page content -->
                                        <div class="span8 page-content" style="margin-top: 30px;">
                                                {volist name='lists'  id='v' }
                                                <article class="format-standard type-post hentry clearfix">

                                                        <header class="clearfix">

                                                                <h3 class="post-title">
                                                                        <a href="{:url('index/post/detail',['id'=>$v['post_id']])}">{$v.postname}</a>
                                                                </h3>

                                                                <div class="col-md-12 col-sm-12 col-xs-7 post-meta clearfix">
                                                                        <span class="date">{$v.posttime}</span>
                                                                        
                                                                        <span class="comments"><a href="#" >评论（{$v.num}）</a></span>
                                                
                                                                        <span  class="glyphicon glyphicon-eye-open" class="like-count" style="position: relative;right:22px; color:#AAAAAA;">浏览（{$v.views}）</span>
                                                                        <!--<span style="position: relative;right:64px; color:#AAAAAA;">浏览（{$v.views}）</span>-->
                                                                        <span class="like-count"  datalove = '{$v.post_id}'>{$v.postlove}</span>
                                                                </div><!-- end of post meta -->

                                                        </header>
                                                        <p  id='p' style="
                                                        height: 55px;/*border: 1px solid black;*/
                                                        overflow:hidden;
                                                        text-overflow:ellipsis;
                                                        display: -webkit-box;
                                                        -webkit-line-clamp:3;
                                                        -webkit-box-orient:vertical;
                                                        ">
                                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                {$v.posttext}

                                                        </p>
                                                </article>
                                                {/volist}
                                                
                                        </div>
                                        <!-- end of page content -->

                                        <!-- start of sidebar -->
                                        <aside class="span4 page-content">

                                                <section class="widget" style="margin-top: 30px;">
                                                        <div class="support-widget">

                                                                <!-- 判断是否登录 -->
                                                                {switch name="session"}
                                                                {case value=""}
                                                                <h3 class="title"><a id='sta' >发新帖</a></h3>
                                                                {/case}
                                                                {default /}
                                                                <h3 class="title"><a href="{:url('index/post/addpost')}">发新帖</a></h3>
                                                                {/switch}
                                                                <!-- 判断是否登录 -->

                                                                <p class="intro">在这里发布自己的想法,自己新的知识技巧等等......</p>
                                                        </div>
                                                </section>


                                                <section class="widget">
                                                        <h3 class="title">热门好帖</h3>
                                                        <ul class="articles">
                                                                {volist name='posthot'  id='val' }
                                                                <li class="article-entry standard">
                                                                        <h4><a href="{:url('index/post/detail',['id'=>$val['post_id']])}">{$val.postname}</a></h4>
                                                                        <span class="article-meta">{$val.posttime}</span>
                                                                        <span class="like-count"  datalove = '{$val.post_id}'>{$val.postlove}</span>
                                                                </li>
                                                                {/volist}
                                                                
                                                        </ul>
                                                </section>



                                                

                                                <section class="widget">
                                                        <h3 class="title">友情连接</h3>
                                                        <ul id="recentcomments">
                                                            {volist name='links' id='val'}
                                                                <li class="recentcomments"><a href='{$val.linksurl}'>{$val.linksname}</a></li>
                                                            {/volist}
                                                        </ul>
                                                </section>

                                        </aside>
                                        <!-- end of sidebar -->
                                </div>
                        </div>
                </div>
                <!-- End of Page Container -->

<script type="text/javascript">
    toastr.options = {
    closeButton: true,// 是否显示关闭按钮
    progressBar: true,// 实现显示计时条
    timeOut: "2000",// 自动关闭时间
    positionClass: "toast-top-right"// 提示位置
    // positionClass: "toast-top-full-width"// 提示位置
    // toast-top-full-width 顶端，宽度铺满整个屏幕
    // toast-top-right  顶端右边
    };

    $('#sta').click(function (){

        toastr.error('你尚未登录');

    });


</script>

<!-- 点赞的ajax -->

<script type="text/javascript">
    
    $('.like-count').click(function (){
        var info = 'postid' + '=' + $(this).attr('datalove');
        var thisbtn = $(this);
        // alert(info);
        $.ajax({
            type: 'post',
            url: '/index/post/postlove',
            data: info,
            dataType : 'json',
            success : function (data){
                 if(data.status){
                    // toastr.success('点赞成功');
                    thisbtn.html(data.love);
                    thisbtn.attr('style','color:blue;');

                    // window.location.reload();

                 }else{
                    toastr.error('点赞失败');
                 }
            },
            error : function () {
                 alert('执行失败');
                
            }
        });

    });

</script>


<!-- 点赞的ajax -->



{/block}